/*
 * Generated file. 
 * 
 * Layout.java
 */
package xsp;

import com.ibm.xsp.page.compiled.AbstractCompiledPage;
import com.ibm.xsp.page.compiled.AbstractCompiledPageDispatcher;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import com.ibm.xsp.page.compiled.NoSuchComponentException;
import com.ibm.xsp.page.compiled.PageExpressionEvaluator;
import java.lang.String;
import java.lang.Object;
import java.lang.Integer;
import com.ibm.xsp.resource.BundleResource;
import com.ibm.xsp.component.FacesPageProvider;
import com.ibm.xsp.resource.ScriptResource;
import com.ibm.xsp.component.UIViewRootEx2;
import com.ibm.xsp.extlib.component.misc.UIKeepSessionAlive;
import com.ibm.xsp.extlib.component.layout.UIApplicationLayout;
import com.ibm.xsp.extlib.component.layout.OneUIApplicationConfiguration;
import com.ibm.xsp.extlib.tree.complex.UserTreeNode;
import javax.faces.el.ValueBinding;
import com.ibm.xsp.extlib.tree.complex.LoginTreeNode;
import com.ibm.xsp.extlib.tree.complex.PageTreeNode;
import com.ibm.xsp.extlib.component.layout.impl.SearchBar;
import com.ibm.xsp.component.xp.XspCallback;
import com.ibm.xsp.component.xp.XspDiv;
import com.ibm.xsp.component.UIIncludeComposite;
import com.ibm.xsp.component.UIPanelEx;
import com.ibm.xsp.component.xp.XspSection;
import com.ibm.xsp.extlib.component.tagcloud.UITagCloud;
import com.ibm.xsp.extlib.component.tagcloud.ViewTagCloudData;
import com.ibm.xsp.component.xp.XspLineBreak;
import com.ibm.xsp.component.UIPassThroughTag;
import com.ibm.xsp.component.UIPassThroughText;

@SuppressWarnings("all")
public class Layout extends AbstractCompiledPageDispatcher{
    
    public Layout() {
        super("8.5.2"); // version of xp:section role
    }

    protected AbstractCompiledPage createPage(int pageIndex) {
        return new LayoutPage();
    }
    
    protected boolean isCustomControl() {
        return true;
    }

    public static class LayoutPage extends AbstractCompiledPage {
        
        private static final ComponentInfo[] s_infos = new ComponentInfo[]{
            ComponentInfo.EMPTY_NORMAL, // 0 "keepsessionalive1"
            ComponentInfo.EMPTY_NORMAL, // 1 "middlecolumnfacetex"
            ComponentInfo.EMPTY_NORMAL, // 2 "rightcolumnfacetex"
            ComponentInfo.EMPTY_NORMAL, // 3 "viewmenu"
            ComponentInfo.EMPTY_NORMAL, // 4 "tagcloud"
            new ComponentInfo(false, new int[]{4}), // 5 "tagcloudsection"
            ComponentInfo.EMPTY_NORMAL, // 6 br
            ComponentInfo.EMPTY_NORMAL, // 7 "authorcloud"
            new ComponentInfo(false, new int[]{7}), // 8 "authorcloudsection"
            new ComponentInfo(false, new int[]{5, 6, 8}), // 9 panel
            ComponentInfo.EMPTY_NORMAL, // 10 "leftcolumnfacetex"
            new ComponentInfo(false, new int[]{3, 9, 10}), // 11 div
            new ComponentInfo(false, new int[]{1}, // 12 "oneuilayout1"
              new Object[][]{
                new Object[]{"RightColumn", Integer.valueOf(2)},
                new Object[]{"LeftColumn", Integer.valueOf(11)},
              } ),
            ComponentInfo.EMPTY_NORMAL, // 13 div2
            ComponentInfo.EMPTY_MARKUP, // 14 text
            new ComponentInfo(true, new int[]{14}), // 15 script
            new ComponentInfo(false, new int[]{0, 12, 13, 15}), // 16 view
        };
        
        public LayoutPage() {
            super(16, s_infos );
        }
        
        public int getComponentForId(String id) throws NoSuchComponentException { 
            if( "keepsessionalive1".equals(id) )
                return 0;
            if( "oneuilayout1".equals(id) )
                return 12;
            if( "middlecolumnfacetex".equals(id) )
                return 1;
            if( "rightcolumnfacetex".equals(id) )
                return 2;
            if( "viewmenu".equals(id) )
                return 3;
            if( "tagcloudsection".equals(id) )
                return 5;
            if( "tagcloud".equals(id) )
                return 4;
            if( "authorcloudsection".equals(id) )
                return 8;
            if( "authorcloud".equals(id) )
                return 7;
            if( "leftcolumnfacetex".equals(id) )
                return 10;
            return -1;
        }
        
        public UIComponent createComponent(int id, FacesContext context,
                UIComponent parent, PageExpressionEvaluator evaluator)
                throws NoSuchComponentException { 
            switch (id) {
            case 16:
                return createView(context, parent, evaluator);
            case 0:
                return createKeepsessionalive1(context, parent, evaluator);
            case 12:
                return createOneuilayout1(context, parent, evaluator);
            case 1:
                return createMiddlecolumnfacetex(context, parent, evaluator);
            case 2:
                return createRightcolumnfacetex(context, parent, evaluator);
            case 11:
                return createDiv(context, parent, evaluator);
            case 3:
                return createViewmenu(context, parent, evaluator);
            case 9:
                return createPanel(context, parent, evaluator);
            case 5:
                return createTagcloudsection(context, parent, evaluator);
            case 4:
                return createTagcloud(context, parent, evaluator);
            case 6:
                return createBr(context, parent, evaluator);
            case 8:
                return createAuthorcloudsection(context, parent, evaluator);
            case 7:
                return createAuthorcloud(context, parent, evaluator);
            case 10:
                return createLeftcolumnfacetex(context, parent, evaluator);
            case 13:
                return createDiv2(context, parent, evaluator);
            case 15:
                return createScript(context, parent, evaluator);
            case 14:
                return createText(context, parent, evaluator);
            }
            throw new NoSuchComponentException(id);
        }
        
        protected void initIncluderAsRoot(FacesContext context,
                PageExpressionEvaluator evaluator, UIComponent root) {
            BundleResource resources = new BundleResource();
            resources.setComponent(root);
            resources.setSrc("/strings.properties");
            resources.setVar("res");
            FacesPageProvider asPageProvider = root instanceof FacesPageProvider ?
                    (FacesPageProvider) root : null;
            if( null != asPageProvider ){
                asPageProvider.addResource(resources);
            }
            ScriptResource resources2 = new ScriptResource();
            resources2.setComponent(root);
            resources2.setClientSide(true);
            resources2.setSrc("/xpDocLinks.js");
            if( null != asPageProvider ){
                asPageProvider.addResource(resources2);
            }
            ScriptResource resources3 = new ScriptResource();
            resources3.setComponent(root);
            resources3.setClientSide(false);
            resources3.setSrc("/xpServerSide.jss");
            if( null != asPageProvider ){
                asPageProvider.addResource(resources3);
            }
            ScriptResource resources4 = new ScriptResource();
            resources4.setComponent(root);
            resources4.setClientSide(false);
            resources4.setSrc("/mobile-server.jss");
            if( null != asPageProvider ){
                asPageProvider.addResource(resources4);
            }
            ScriptResource resources5 = new ScriptResource();
            resources5.setComponent(root);
            resources5.setClientSide(false);
            resources5.setSrc("/xpCGIVariables.jss");
            if( null != asPageProvider ){
                asPageProvider.addResource(resources5);
            }
        }

        private UIComponent createView(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIViewRootEx2 result = new UIViewRootEx2();
            initViewRoot(result);
            BundleResource resources = new BundleResource();
            resources.setComponent(result);
            resources.setSrc("/strings.properties");
            resources.setVar("res");
            result.addResource(resources);
            ScriptResource resources2 = new ScriptResource();
            resources2.setComponent(result);
            resources2.setClientSide(true);
            resources2.setSrc("/xpDocLinks.js");
            result.addResource(resources2);
            ScriptResource resources3 = new ScriptResource();
            resources3.setComponent(result);
            resources3.setClientSide(false);
            resources3.setSrc("/xpServerSide.jss");
            result.addResource(resources3);
            ScriptResource resources4 = new ScriptResource();
            resources4.setComponent(result);
            resources4.setClientSide(false);
            resources4.setSrc("/mobile-server.jss");
            result.addResource(resources4);
            ScriptResource resources5 = new ScriptResource();
            resources5.setComponent(result);
            resources5.setClientSide(false);
            resources5.setSrc("/xpCGIVariables.jss");
            result.addResource(resources5);
            return result;
        }

        private UIComponent createKeepsessionalive1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIKeepSessionAlive result = new UIKeepSessionAlive();
            setId(result, "keepSessionAlive1");
            return result;
        }

        private UIComponent createOneuilayout1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIApplicationLayout result = new UIApplicationLayout();
            OneUIApplicationConfiguration configuration = new OneUIApplicationConfiguration();
            configuration.setComponent(result);
            configuration.setLegalText("(c) Copyright IBM Corporation 2012");
            String placeBarNameBnd = "#{javascript:database.getTitle()}";
            String sourceId = "oneUILayout1/xe:this.configuration[1]/xe:oneuiApplication[1]/xe:this.placeBarName[1]/text()";
            Object placeBarName = evaluator.getBindingValue(result, placeBarNameBnd, sourceId, String.class);
            evaluator.setValue(configuration, "placeBarName", placeBarName, String.class);
            UserTreeNode bannerUtilityLinks = new UserTreeNode();
            bannerUtilityLinks.setComponent(result);
            String sourceId2 = "oneUILayout1/xe:this.configuration[1]/xe:oneuiApplication[1]/xe:this.bannerUtilityLinks[1]/xe:userTreeNode[1]/xe:this.label[1]/text()";
            String labelExpr = "#{javascript:I18n.format(res.getString(\"welcome.x\"), userBean.displayName)}";
            ValueBinding label = evaluator.createValueBinding(result, labelExpr, sourceId2,String.class);
            bannerUtilityLinks.setValueBinding("label", label);
            configuration.addBannerUtilityLink(bannerUtilityLinks);
            LoginTreeNode bannerUtilityLinks2 = new LoginTreeNode();
            bannerUtilityLinks2.setComponent(result);
            configuration.addBannerUtilityLink(bannerUtilityLinks2);
            PageTreeNode bannerUtilityLinks3 = new PageTreeNode();
            bannerUtilityLinks3.setComponent(result);
            bannerUtilityLinks3.setLabel("My Profile");
            bannerUtilityLinks3.setPage("/authorProfile.xsp");
            configuration.addBannerUtilityLink(bannerUtilityLinks3);
            String navigationPathBnd = "#{javascript:compositeData.navigationPath}";
            String sourceId3 = "oneUILayout1/xe:this.configuration[1]/xe:oneuiApplication[1]/@navigationPath";
            Object navigationPath = evaluator.getBindingValue(result, navigationPathBnd, sourceId3, String.class);
            evaluator.setValue(configuration, "navigationPath", navigationPath, String.class);
            configuration.setDefaultNavigationPath("/allDocuments.xsp");
            SearchBar searchBar = new SearchBar();
            searchBar.setComponent(result);
            String sourceId4 = "oneUILayout1/xe:this.configuration[1]/xe:oneuiApplication[1]/xe:this.searchBar[1]/xe:appSearchBar[1]/@rendered";
            String renderedExpr = "#{javascript:database.isFTIndexed()}";
            ValueBinding rendered = evaluator.createValueBinding(result, renderedExpr, sourceId4,boolean.class);
            searchBar.setValueBinding("rendered", rendered);
            searchBar.setQueryParam("searchValue");
            searchBar.setInactiveText("Search...");
            searchBar.setPageName("/allDocuments.xsp");
            searchBar.setInputTitle("Enter a search value");
            searchBar.setOptionsParam("searchValue");
            configuration.setSearchBar(searchBar);
            configuration.setFooter(false);
            configuration.setBanner(true);
            result.setConfiguration(configuration);
            setId(result, "oneUILayout1");
            return result;
        }

        private UIComponent createMiddlecolumnfacetex(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspCallback result = new XspCallback();
            setId(result, "middleColumnFacetEx");
            return result;
        }

        private UIComponent createRightcolumnfacetex(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspCallback result = new XspCallback();
            result.setFacetName("RightColumn");
            setId(result, "rightColumnFacetEx");
            return result;
        }

        private UIComponent createDiv(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspDiv result = new XspDiv();
            return result;
        }

        private UIComponent createViewmenu(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            String resultPage = "/viewMenu.xsp";
            UIIncludeComposite result = new UIIncludeComposite();
            result.setPageDriver(getPageParam().getPageDriver());
            result.setPageName(resultPage);
            setId(result, "viewMenu");
            return result;
        }

        private UIComponent createPanel(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            result.setStyleClass("layoutPanel");
            return result;
        }

        private UIComponent createTagcloudsection(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspSection result = new XspSection();
            result.setRole("filter");
            result.setStyleClass("layoutSection");
            setId(result, "tagCloudSection");
            result.setHeader("Tags");
            return result;
        }

        private UIComponent createTagcloud(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UITagCloud result = new UITagCloud();
            result.setSliderVisible(true);
            result.setAlternateText("{0} documents");
            setId(result, "tagCloud");
            result.setRendererType("com.ibm.xsp.extlib.OneUITagCloud");
            ViewTagCloudData cloudData = new ViewTagCloudData();
            cloudData.setComponent(result);
            cloudData.setViewName("xpCategoryCloud");
            cloudData.setTagThreshold(5);
            cloudData.setMaxTagLimit(50);
            cloudData.setCacheMode("auto");
            cloudData.setSortTags("alphabet");
            cloudData.setLinkRequestParam("categoryFilter");
            cloudData.setLinkTargetPage("/byTag.xsp");
            cloudData.setCacheRefreshInterval(120);
            result.setCloudData(cloudData);
            return result;
        }

        private UIComponent createBr(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspLineBreak result = new XspLineBreak();
            return result;
        }

        private UIComponent createAuthorcloudsection(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspSection result = new XspSection();
            result.setRole("filter");
            result.setStyleClass("layoutSection");
            setId(result, "authorCloudSection");
            result.setHeader("Authors");
            return result;
        }

        private UIComponent createAuthorcloud(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UITagCloud result = new UITagCloud();
            result.setSliderVisible(true);
            result.setAlternateText("{0} documents");
            setId(result, "authorCloud");
            result.setRendererType("com.ibm.xsp.extlib.OneUITagCloud");
            ViewTagCloudData cloudData = new ViewTagCloudData();
            cloudData.setComponent(result);
            cloudData.setViewName("xpByAuthor");
            cloudData.setMaxTagLimit(30);
            cloudData.setCacheMode("auto");
            cloudData.setSortTags("alphabet");
            cloudData.setLinkRequestParam("lookupName");
            cloudData.setLinkTargetPage("/authorProfile.xsp");
            cloudData.setCacheRefreshInterval(120);
            result.setCloudData(cloudData);
            return result;
        }

        private UIComponent createLeftcolumnfacetex(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspCallback result = new XspCallback();
            result.setFacetName("LeftColumn");
            setId(result, "leftColumnFacetEx");
            return result;
        }

        private UIComponent createDiv2(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspDiv result = new XspDiv();
            result.setStyleClass("ie6Shim");
            return result;
        }

        private UIComponent createScript(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPassThroughTag component = new UIPassThroughTag();
            component.setTag("script");
            return component;
        }

        private UIComponent createText(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            String text = "//Place shim inside .lotusMain\n\tif(dojo.isIE <= 6){\n\t\tdojo.addOnLoad(function(){\n\t\t\tvar shim = dojo.query(\'.ie6Shim\');\n\t\t\tvar main = dojo.query(\'.lotusMain\')[0].appendChild(shim[0]);\n\t\t});\n\t}";
            UIPassThroughText textComp = new UIPassThroughText();
            textComp.setText(text);
            return textComp;
        }

    }
}
